package com.wty.basic.pojo;



import java.util.Objects;

/**
 * 学生类
 */
public class Student implements  Cloneable{
    @Override
    public Object clone() throws CloneNotSupportedException {
        Student student= (Student) super.clone();
        student.school= (School) student.school.clone();
        return student;
    }

    /**
     * 学生姓名
     */
    private String name;

    /**
     * 学生年龄
     */
    private int age;

    /**
     * 学生所在学校
     */
    private School school;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public School getSchool() {
        return school;
    }

    public void setSchool(School school) {
        this.school = school;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age &&
                Objects.equals(name, student.name) &&
                Objects.equals(school, student.school);
    }

    @Override
    public int hashCode() {

        return Objects.hash(name, age, school);
    }

    public Student(String name, int age, School school) {
        this.name = name;
        this.age = age;
        this.school = school;
    }

    public Student() {
    }
}
